<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<script type="text/javascript" charset="utf-8" src="/plug-in/ueditor/ueditor.config.js?addd=ddd"></script>
<script type="text/javascript" charset="utf-8" src="/plug-in/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/plug-in/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/plug-in/ueditor/jformdesign/fplugins.v1.js?a=ddd"></script>
<style type="text/css">
	.toolbar{padding: 10px;}
	.toolbar .item{margin-top: 5px;}
	.easyui-linkbutton{width: 120px;}
</style>
<title>流程表单</title>
<script>
$(function() {
	//var formConfig = '${jForm.formConfig}';
	//var formConfig = UE.htmlparser(formConfig, true);
	//var html = formConfig.toHtml();
	//console.log(html);
	//$("#formEditor").html(html);
	if(finputFn){
		finputFn.initEditor();
	}
	
	$('#dl').datalist({
		singleSelect: false,
		textField: 'fieldTitle',
		valueField:'fieldName',
		selectOnCheck: false,
		checkOnSelect: false,
		url:'/console/jForm/rewrite/getDbGrid?formId=${param.formId}',    
		textFormatter:function(value,row,index){
			return (row.fieldTitle || '待定') + " - " +   row.fieldName + " - "+ (row.fieldPlug || '待定') ;
		},
		onCheck:function(index, row){
			var root = UE.htmlparser(finputFn.editor.getContent(), true);
			var node = root.getNodeById(row.fieldName);
			if(node){
				$.messager.show({
					title:'消息提醒',
					msg:'已经添加到设计表单!',
					timeout:5000,
					showType:'slide'
				});
			}else{
				finputFn.exec(row.fieldPlug,row);
			}
		},
		loadFilter:function(data){
			var rows = [];
			var row = null;
			if(data){
				for(var i=0,len=data.rows.length; i<len;i++){
					row = data.rows[i];
					if(row.fieldEnabled=='Y'){
						rows.push(row);
					}
				}
			}
			return {rows:rows,total:rows.length};
		},
	    checkbox: true, 
	    lines: true 
	});
	
});
</script>
</head>
<body class="easyui-layout">
	<form name="saveform" id="saveform" action="" style="display: none;" method="post">
		<input name="formId" value="${param.formId}"/>
		<textarea name="editorContent"></textarea>
	</form>

    <div data-options="region:'west',title:'表单控件',split:true" style="width:200px;">
    	<div id="dl"></div>	
    </div>   
    <!-- 
	<div data-options="region:'north',title:'North Title',split:true" style="height:100px;"></div>
    <div data-options="region:'south',split:true,collapsible:false" style="height:150px;text-align:center;">
    	<div style="padding: 10px;">
    		<table id="dataGrid" title="表单元素列表" style="width:100%;height:100px;"></table>
    	</div>
    </div>   
   <div data-options="region:'east',iconCls:'icon-reload',title:'属性设计',split:true" style="width:300px;">
   		<div id="propGrid" style="width:290px;"></div>  
   </div>
     -->
    <div data-options="region:'center'" style="background:#eee;" id="centerDiv">
		<script type="text/plain" id="formEditor" style="margin:25px;">${jForm.formConfig}</script>
    </div>   
</body>
</html>
